package com.eastfair.builder.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 展商
 * </p>
 *
 * @author linan
 * @date 2023-02-02
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ExhibitorSettleStatusEnum", description = "结算状态 #{NOT_APPLIED:未申请;REQUESTED:已申请;HAS_SETTLE:已结算-枚举")
public enum ExhibitorSettleStatusEnum implements BaseEnum {

    /**
     * NOT_APPLIED="未申请"
     */
    NOT_APPLIED("未申请"),
    /**
     * REQUESTED="已申请"
     */
    REQUESTED("已申请"),
    /**
     * HAS_SETTLE="已结算"
     */
    HAS_SETTLE("已结算"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ExhibitorSettleStatusEnum match(String val, ExhibitorSettleStatusEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ExhibitorSettleStatusEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ExhibitorSettleStatusEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "NOT_APPLIED,REQUESTED,HAS_SETTLE", example = "NOT_APPLIED")
    public String getCode() {
        return this.name();
    }

}
